<template>
    <div>
        <Card>
            <p slot="title">预约审核</p>
            <list-frm :loading="loading" :listData="listData" :pageNum="pageNum" @onCancel="onCancel"></list-frm>
        </Card>
        <page :total="total" :pageNum="pageNum" :pageSize="pageSize" @page-on-size="onPageSize" @page-on-change="pageChange"></page>
    </div>
</template>

<script>

import listFrm from './check/list.vue'
import Page from '@/view/components/page/page.vue'
import { getOrderCheck } from '@/api/order'

export default {
  name: 'checkList',
  components: {
    listFrm,
    Page
  },
  data () {
    return {
      pageNum: 1,
      total: 0,
      pageSize: 10,
      loading: true,
      listData: []
    }
  },
  mounted: function () {
    this.getOrderCheck()
  },
  methods: {
    pageChange (pageNum) {
      this.pageNum = pageNum
      this.getOrderCheck()
    },
    onPageSize (pageSize) {
      this.pageSize = pageSize
      this.getOrderCheck()
    },
    getOrderCheck () {
      this.loading = true
      const pageNum = this.pageNum
      const pageSize = this.pageSize
      getOrderCheck({ pageNum, pageSize }).then(res => {
        const data = res.data
        if (data.code === 200) {
          this.total = data.data.total
          this.listData = data.data.list
          this.loading = false
        } else {
          this.$Message.error(data.error)
        }
      }).catch((err) => {
        console.log(err)
        this.$Message.error('数据获取失败')
      })
    },
    onCancel () {
      this.getOrderCheck()
    }
  }
}
</script>

<style lang="" scoped>

</style>
